GETRLIMIT
Section: MINTLIB LIBRARY FUNCTIONS
(3)
Updated: 3 March 1993
Index
Return to Main Contents
NAME
getrlimit, setrlimit - control maximum system resource con-
sumption
SYNOPSIS
#include <sys/time.h>
#include <sys/resource.h>
int getrlimit(int kind, struct rlimit *rlp);
int setrlimit(int kind, struct rlimit *rlp);
DESCRIPTION
Limits on the consumption of system resources by the current
process and each process it creates may be obtained with the
getrlimit call, and set with the setrlimit call. These
functions only work for real if MiNT is active.
The following resource parameters are allowed:
RLIMIT_CPU the maximum amount of cpu time (in
milliseconds) to be used by each process.
RLIMIT_FSIZE the largest size, in bytes, of any single
file that may be created.
RLIMIT_DATA the maximum size, in bytes, of the data
the process may allocate with Malloc.
RLIMIT_STACK the maximum size, in bytes, of the stack
segment for a process.
RLIMIT_CORE the largest size, in bytes, of a core file
that may be created.
RLIMIT_RSS the maximum size, in bytes, allowed for
the process.
Of these, only the RLIMIT_CPU, RLIMIT_DATA and RLIMIT_RSS
parameters are supported. The others do nothing. The UN*X
parameter RLIMIT_NOFILE is not available in the header file
at all. Also, the value of the RLIMIT_CPU parameter is in
milliseconds, while the UN*X version is specified in seconds.
A resource limit is specified as a soft limit and a hard
limit. When a soft limit is exceeded a process receives
a signal SIGXCPU if the cpu time is exceeded; memory
allocations will fail if RLIMIT_DATA or RLIMIT_RSS is
exceeded. Hard limits are not enforced at all.
The struct rlimit is defined as follows:
struct rlimit
{
long rlim_cur; /* current (soft) limit */
long rlim_max; /* hard limit (not supported) */
};
Contradicting the UN*X version, any process may increase
its limits at will.
An "infinite" value for a limit is defined as RLIM_INFINITY
(0x7fffffff).
RETURN VALUES
getrlimit and setrlimit return:
0 on success.
-1 on failure; errno is set to EINVAL.
SEE ALSO
Psetlimit(2),
getrusage(3),
signal(3)
BUGS
These functions are so different from their UN*X equivalents
that they are practically worthless.
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- RETURN VALUES
-
- SEE ALSO
-
- BUGS
-
This document was created by
man2html,
using the manual pages.
Time: 11:14:40 GMT, June 22, 2025